<template>
      <div
      class="chart-container"
      style="height: 1200px; background-color: white"
    ></div>
</template>

<script>
// npm i d3-org-chart
import { OrgChart } from 'd3-org-chart';
// 测试数据
import { getD3data } from '@/utils/d3.data'

// 引入d3
// import * as d3 from 'd3';

export default {
    data() {
        return {
            data : [{

            }]
        }
    },
    methods: {
        draw(dataFlattened) {
          
          const chart = new OrgChart()
            .container('.chart-container')
            .data(dataFlattened) // https://gist.github.com/bumbeishvili/40fc87bdcdc4d7a1919e4cce2fed10f9
            .render();
        
          }
    },
    mounted() {
        this.draw(getD3data());
    }

}
</script>


<style>

</style>